/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view.administration.saisienotes;

import dao.DAOCour;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import model.Enseignant;
import view.Connexion;

/**
 *
 * @author Paul
 */
public class CreationCours extends HttpServlet {

    @Override
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    }

    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String intitule = request.getParameter("intitule");
        DAOCour daoCour = new DAOCour();
        boolean create = daoCour.create(intitule, 2);
        if (create) {
            request.setAttribute("message", "Le cours a bien été crée");
            request.getRequestDispatcher("WEB-INF/view/administration/gestionCours.jsp").forward(request, response);
        } else {
            Logger.getLogger(Connexion.class.getName()).log(Level.SEVERE, "Utilisateur sans type");
            request.getRequestDispatcher("WEB-INF/view/administration/gestionCours.jsp").forward(request, response);
        }
    }
}
